# _*_ coding : utf-8 _*_
# @Time : 2025/5/1 20:42
# @Author : liuchengjie
# @File : mqtt_connection
# @Project : esp32_s3
import network


# Wi-Fi 配置
# wifi_ssid = "CMCC-SP7s"
# wifi_password = "64223333"
wifi_ssid = "zdkj"
wifi_password = "99999999"


def connect_wifi():
    sta_if = network.WLAN(network.STA_IF)
    sta_if.active(True)
    if not sta_if.isconnected():
        print("正在连接 Wi-Fi...")
        sta_if.connect(wifi_ssid, wifi_password)
        while not sta_if.isconnected():
            pass
    print("Wi-Fi 已连接！IP地址:", sta_if.ifconfig()[0])





